PAGE 3

OOP ALLEY


"Programming is understanding." - Kristen Nygaard

CVG5

Some notes, if needed, on Euclidian Geometry: 
     
     The primary difference has to do with the parallel postulate. In Euclidian 
     geometry, given a line with a point outside (and not on said line), you can 
     draw only one line thru the point which will be parallel to the aforementioned 
     line.  Non-Euclidian geometries can allow no parallel lines thru the point or 
     an infinite number of parallel lines. The names are "hyperbolic geometry" and 
     "elliptic geometry". 

  Euclidean Geometry

     Euclid's presentation of plane geometry is based on a number of theorems that 
     can all be derived from five postulates (axioms) and five common notions. 

     The axioms are: 

        1.Exactly one straight line can be drawn between any two points. 
        2.A straight line can be continued indefinitely. 
        3.With any point as center, a circle with any radius may be described. 
        4.All right angles are equal. 
        5.Through a given point outside a given straight line, there passes only 
          one line parallel to the given line; that is, such a line does not 
          intersect the given line. 

     The common notions are: 

        1.Things equal to the same thing are equal. 
        2.If equals are added to equals, the wholes are equal. 
        3.If equals are subtracted from equals, the remainders are equal. 
        4.Things which coincide with one another are equal. 
        5.The whole is greater than a part. 

     From his postulates and notions, Euclid deduced 465 theorems.
     The section above was borrowed from(click to:) Math Teachers Home Page, A source book for teachers.

Here is another author's look at invoking methods and parameter passing from Java Software Solutions, Foundations of program design, by Lewis & Loftus, Reading PA, Addison-Wesley, 1998 A method is a group of programming language statements that are given a name. A method is associated with a particular class. Each method has a method definition that specifies the code that gets executed when the method is invoked. When a method is called (invoked -WedB), the flow of control transfers to that method. One by one, the statements of that method are executed. When that method is done, control returns to the location where the call was made and execution continues. The header of a method includes the type of return value, the method name, and a list of parameters that the method accepts. The list of statements that makes up the body of the method are defined in a block (between { and } -Wedb). The following code is the definition of a method called third_power:


  int third_power (int number) {
     int cube;
     cube = number * number * number;
     return cube;
  }  // method third_power        

 

Local variables like our cube do not exist except when when the method is executing; therefore the value stored in a local variable is lost from one invocation of the method to the next. If you want a value to be maintained from one call to the next, you should define the variable at the class level. (As we see, -WedB) the declaration of a local variable can be mixed into the statement list, but it must be declared before it is used. The return statement Methods can return a value, whose type must correspond to the return type in the method header. The return type can be a primitive type or a reference to an object. [Note: Each value in memory is associated with a specific data type. This data type detrmines what opererations we can perform on the data. Variables in Java are either primitive types, like integers or characters, or they are references to objects, -----> Based on our lowerLeft and upperRight objects created in the section on instantiating objects, previously, you could invoke distance like this: double d = lowerLeft.distance(upperRight); After this statement executes, the variable d contains the Euclidian distance between lowerLeft and upperRight.

The This Reference Occasionally, the receiving object needs to know its own referrence. For example, the receiving object might want to add itself to to a list of objects somewhere. An implicit reference named this is available to methods, and this is a reference to the current (receiving) object. The following definition of clear is equivalent to the one just presented [on page 2 -WedB]:


public void clear() {
      this.x = 0;
      this.y = 0;
}  

   

00:25 11/21/99

Email me at memphis@consultant.com

Moyra's Web Jewels

This page created by BITS

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>